import com.tedu.springdemo.day03.Demo;
import com.tedu.springdemo.day03.Trail;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class test06 {
    //DI  依赖注入：创建对象 属性注入
    @Test
    public void test01()
    {
        ApplicationContext ac=new ClassPathXmlApplicationContext("beans11.xml");
        Demo d1=(Demo)ac.getBean("demo");
        System.out.println(d1);
        ((ClassPathXmlApplicationContext)ac).close();
    }
    @Test
    public void test02()
    {
        ApplicationContext ac=new ClassPathXmlApplicationContext("beans12.xml");
        Trail t=(Trail)ac.getBean("Trail");
        System.out.println(t);
        ((ClassPathXmlApplicationContext)ac).close();
    }
}
